package apps.softtech.fastmarket;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

public class ReceiverNetworkStateChange extends BroadcastReceiver {

	final String TAG = "Receiver network state change";

	@Override
	public void onReceive(Context context, Intent intent) {

		Log.e(TAG, "lay dc intent =" + intent.getAction());

		boolean noConnectivity = intent.getBooleanExtra(
				ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
		String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON);
		boolean isFailover = intent.getBooleanExtra(
				ConnectivityManager.EXTRA_IS_FAILOVER, false);

		NetworkInfo currentNetworkInfo = (NetworkInfo) intent
				.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
		NetworkInfo otherNetworkInfo = (NetworkInfo) intent
				.getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO);

		// do application-specific task(s) based on the current network state,
		// such
		// as enabling queuing of HTTP requests when currentNetworkInfo is
		// connected etc.
	}
}
